from pylab import *
from astropy.io import fits
from astropy.nddata import CCDData

#flat_a = fits.open('10_a.fits')
#flat_b = fits.open('10_b.fits')

#img_a = array(flat_a[0].data, dtype=int)
#img_b = array(flat_b[0].data, dtype=int)

#img = img_a - img_b

#x = CCDData(img, unit='adu', dtype=int16)
#x.write('flat_substract.fits')

flat_a = fits.open('10_a.fits')
flat_b = fits.open('10_b.fits')

img_a = array(flat_a[0].data, dtype=int)
img_b = array(flat_b[0].data, dtype=int)

img_sum = img_a + img_b

x = CCDData(img_sum, unit='adu')
x.write('flat_sum.fits')


#bias_a = fits.open('bias_5.fits')
#bias_b = fits.open('bias_6.fits')

#img_a = array(bias_a[0].data, dtype=int)
#img_b = array(bias_b[0].data, dtype=int)

#img_sub = img_a - img_b
#img_sum = img_a + img_b

#x_sub = CCDData(img_sub, unit='adu')
#x_sum = CCDData(img_sum, unit='adu')

#x_sub.write('bias_sub.fits')
#x_sum.write('bias_sum.fits')

imshow(img_sum)

show()
